<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>网页时钟</title>
</head>

<body>
当前系统时间为：<span id = "spanTip"></span>
</body>
<script>
    function genDate(){
        var date = new Date();
        //拼接时间
        var dateStr = date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDate()+"日&nbsp;&nbsp"+
            date.getHours()+"时"+date.getMinutes()+"分"+date.getSeconds()+"秒";

        var spanTip = document.getElementById("spanTip");

        spanTip.innerHTML = dateStr;
    }
    window.setInterval("genDate()",1000);

</script>
</html>

